Skip to content

feat(optimizer): [1/N] Optimizer Repository#530

Open
mkuchenbecker wants to merge 4 commits intomkuchenb/optimizer-0from
mkuchenb/optimizer-1
Open

feat(optimizer): [1/N] Optimizer Repository#530
mkuchenbecker wants to merge 4 commits intomkuchenb/optimizer-0from
mkuchenb/optimizer-1

Conversation

@mkuchenbecker
Copy link
Copy Markdown
Collaborator

@mkuchenbecker mkuchenbecker commented Apr 6, 2026

Optimizer Stack

PR Content
#527 Data Model
#530 (this) Database Repos
#531 REST service
#533 Analyzer app
#534 Scheduler app
#tbd Spark BatchedOFD app
#tbd Infra, docker-compose, smoke test

Summary

PR 1 of N in the optimizer stack.
Overall Project
Service Design doc.

Spring Data JPA repositories for all four optimizer tables with filtered query support, plus tests exercising save/find, filtered queries, upsert semantics, and append-only history.

Changes

  • Client-facing API Changes
  • Internal API Changes
  • Bug Fixes
  • New Features
  • Performance Improvements
  • Code Style
  • Refactoring
  • Documentation
  • Tests

Repositories: TableOperationsRepository, TableOperationsHistoryRepository, TableStatsRepository, TableStatsHistoryRepository — each with JPQL filtered query methods.

Tests: Repository tests for all four tables plus OptimizerServiceContextTest verifying the Spring context loads.

Testing Done

  • Manually Tested on local docker setup. Please include commands ran, and their output.
  • Added new tests for the changes made.
  • Updated existing tests to reflect the changes made.
  • No tests added or updated. Please explain why. If unsure, please feel free to ask for help.
  • Some other form of testing like staging or soak time in production. Please explain.

./gradlew :services:optimizer:test — all tests pass (H2 in MySQL mode).

Additional Information

  • Breaking Changes
  • Deprecations
  • Large PR broken into smaller PRs, and PR plan linked in the description.

Spring Data JPA repositories for all four optimizer tables with
filtered query support. Includes tests exercising save/find,
filtered queries, upsert semantics, and append-only history.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mkuchenbecker and others added 3 commits April 6, 2026 11:35
Address PR review comments: rename findFiltered → find across all repos,
remove redundant findByTableUuid/findByTableUuidSince from history repos,
add explicit assertion to context test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shared JPA entities and repositories for optimizer apps (analyzer,
scheduler). All repos expose a single find method with optional filters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Propagate CompleteOperationRequest orphan field removal.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mkuchenbecker mkuchenbecker changed the title feat(optimizer): add repositories and repository tests feat(optimizer): [1/N] Optimizer Repository Apr 6, 2026
@mkuchenbecker mkuchenbecker changed the title feat(optimizer): [1/N] Optimizer Repository feat(optimizer): [2/N] Optimizer Repository Apr 6, 2026
@mkuchenbecker mkuchenbecker marked this pull request as ready for review April 6, 2026 19:46
@mkuchenbecker mkuchenbecker changed the title feat(optimizer): [2/N] Optimizer Repository feat(optimizer): [1/N] Optimizer Repository Apr 6, 2026
@Column(name = "id", nullable = false, length = 36)
private String id;

@Column(name = "table_uuid", nullable = false, length = 36)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to capture databaseId and tableId for getting historical insights on table operations.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude: Added databaseName and tableName columns (both VARCHAR(128)) to TableOperationHistoryRow in commit 027fccd6. The underlying schema already carries them, so this is purely an entity-level addition that lets analyst-style queries read the history without joining back to table_operations.


dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.7.8'
implementation 'com.vladmihalcea:hibernate-types-55:2.21.1'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where exactly this dependency is used? Seems like new dependency.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude: It is used by TableStatsRow in this shared module. The @TypeDef(name = "json", typeClass = JsonStringType.class) and @Type(type = "json") annotations on TableStatsRow.stats and TableStatsRow.tableProperties resolve to com.vladmihalcea.hibernate.type.json.JsonStringType, which lives in this dependency. It is the same library already used by services/optimizer for the same purpose.

mkuchenbecker added a commit to mkuchenbecker/openhouse that referenced this pull request May 1, 2026
…y row

Address PR linkedin#530 review feedback: the lightweight read-side
TableOperationHistoryRow in the apps/optimizer shared module did
not surface the denormalized database_name and table_name columns,
even though the underlying schema carries them. Add them so
analyst-style queries from the analyzer/scheduler side can read
operation history without joining back to table_operations.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants